334B - Eight Point Sets - CodeForces Solution


sortings *1400

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define  fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
const  long long int N=1e4;
 
int main()
{
	fast;	
	long long int x,y;
	set<long long int>se3;
	set<long long int>se4;
	vector<pair<long long int,long long int>>vec;
	for(long long int i(0);i<8;i++){
		cin>>x>>y;
		se3.insert(x);
		se4.insert(y);
		vec.push_back(make_pair(x,y));}
	if((se3.size()!=3)or(se4.size()!=3)){
		cout<<"ugly"<<endl;}
	else{
		vector<long long int>se1(se3.begin(),se3.end());
		vector<long long int>se2(se4.begin(),se4.end());
		sort(se1.begin(),se1.end());
		sort(se2.begin(),se2.end());
		bool test=true;
		for(auto v:se1){
			for(auto u:se2){
				if((find(vec.begin(),vec.end(),make_pair(v,u))==vec.end())and(not((v==se1[1])and(u==se2[1])))){
					test=false;break;}}if(test==false)break;}
		if(test==false)cout<<"ugly"<<endl;
		else cout<<"respectable"<<endl;}
		
		
	
	
	
	
	
	
		
	
	
	
	
	
	
	
	
	
	
	
	
 
	
 
	
		
		
			
		
	
	
	
	
 
			
 
 
	
	
	
	
	
	
		
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		
		
		
		
		
	
	
	
	
	
		
	
		
		
		
	
	
	
	
	
	
	
	
	
 
 
	
	
		
	
		
		
		
	
 
 
	
 
 
 
	
	
	
	
	
 
	
	
	
	
	
 
	
 
	
	
		
	
	
	
	
	
	
return 0;}


Comments

Submit
0 Comments
More Questions

892A - Greed
32A - Reconnaissance
1236D - Alice and the Doll
1207B - Square Filling
1676D - X-Sum
1679A - AvtoBus
1549A - Gregor and Cryptography
918C - The Monster
4B - Before an Exam
545B - Equidistant String
1244C - The Football Season
1696B - NIT Destroys the Universe
1674A - Number Transformation
1244E - Minimizing Difference
1688A - Cirno's Perfect Bitmasks Classroom
219A - k-String
952A - Quirky Quantifiers
451B - Sort the Array
1505H - L BREAK into program
171E - MYSTERIOUS LANGUAGE
630D - Hexagons
1690D - Black and White Stripe
1688D - The Enchanted Forest
1674C - Infinite Replacement
712A - Memory and Crow
1676C - Most Similar Words
1681A - Game with Cards
151C - Win or Freeze
1585A - Life of a Flower
1662A - Organizing SWERC